Skip to content

feat(mpp): advertise Tempo MPP session intent + thread settlementOverrides#183

Open
badjer wants to merge 2 commits into
mainfrom
feat/mpp-tempo-sessions
Open

feat(mpp): advertise Tempo MPP session intent + thread settlementOverrides#183
badjer wants to merge 2 commits into
mainfrom
feat/mpp-tempo-sessions

Conversation

@badjer

@badjer badjer commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Phase 4 — SDK wire contract for Tempo MPP sessions

Lets a resource server advertise the TIP-1034 session intent and settle the metered actual for MPP. Backwards-compatible: the session intent is advertised only when the auth server exposes a settler (/mpp/supported), and charge stays the default.

  • omniChallenge.ts: fetchMppSupported() (GET /mpp/supported, TTL-cached, same pattern as the x402 /supported fetch); buildMppChallenges advertises a tempo intent:'session' challenge (with methodDetails: escrowContract / authorizedSigner / operator) alongside charge when mppSession is present; threaded through buildOmniChallenge + buildPaymentOptions.
  • protocol.ts: MPP buildRequestBody threads actualAmount → settlementOverrides.amount (raw µUSDC) for session credentials so auth settles the metered actual; removed the settle_actual_dropped warning.
  • requirePayment.ts: fetch /mpp/supported alongside /x402/supported, threaded into the challenge.

Verified

Local E2E on Tempo mainnet with the accounts + auth PRs: session metered locally and settled the actual ($0.003, txHash 0x88f97ba7…).

Pairs with the accounts + auth PRs.

🤖 Generated with Claude Code

badjer and others added 2 commits June 18, 2026 15:57
…rides

Phase 4 SDK wire contract for TIP-1034 Tempo MPP sessions. Backwards-compatible:
the session intent is advertised only when the auth server exposes a settler, and
charge stays the default.

- omniChallenge.ts: fetchMppSupported() (GET /mpp/supported, TTL-cached like the
  x402 /supported fetch); buildMppChallenges advertises a tempo intent:'session'
  challenge (methodDetails: escrowContract/authorizedSigner/operator) alongside
  charge when mppSession is present; threaded through buildOmniChallenge +
  buildPaymentOptions.
- protocol.ts: MPP buildRequestBody threads actualAmount -> settlementOverrides
  .amount (raw uUSDC) for session credentials so auth settles the metered actual;
  removed the settle_actual_dropped warning.
- requirePayment.ts: fetch /mpp/supported alongside /x402/supported, threaded in.

Verified E2E on Tempo mainnet with accounts + auth (session settles the actual).
Pairs with accounts + auth PRs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…iled settle retryable

A TIP-1034 session opens an on-chain channel (deposit locked) at authorize, so it must settle even at spent=0 to refund the deposit -- the spent<=0 early-return stranded it. Scope that to channel sessions via PaymentSessionState.requiresClose; one-shot atxp/x402 keep the no-op-at-zero-spend behavior. On settle failure, leave a channel session unsettled so the locked deposit can be re-driven later (on-chain close is idempotent); one-shot protocols still mark settled (nothing to re-drive). Add a re-entrancy (settling) guard. Share isMppSessionCredential between protocol.ts and paymentSession.ts so both classify a credential identically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant